/*
 * simpleAssert.h
 *
 *  Created on: 19.04.2012
 *      Author: Anthea Neums
 */

#ifndef SIMPLEASSERT_H_
#define SIMPLEASSERT_H_


#define ____ 'x'
#define _____ 42
#define ______ 42.42
#define _______ "42"
#define ________ false
#define _________ true


#include <string>
#include <strings.h>
#include <iostream>
#include <typeinfo>

#include "StopMeditating.h"
using namespace std;



//void reportUnmetExpectation(string message, char *expected, char *actual){
//cout << "Expectation Failed: " << message << endl;
//cout << "Expected: " << expected << ", but was: " << actual << endl;
//if (QUIT_ON_UNMET_EXPECTATION)
//throw StopMeditating();
//}

template <class T>
void reportUnmetExpectation(string message, T expected, T actual){
cout << "Expectation Failed: " << message << endl;
cout << "Expected: " << expected << ", but was: " << actual << endl;
if (QUIT_ON_UNMET_EXPECTATION)
throw StopMeditating();
}

template <class T>
void expectThatRaw (string message, T expected, T actual) {
	if (expected != actual) {
		reportUnmetExpectation(message,expected,actual);
	}
}
template <class T>
void expectThatNotRaw (string message, T expected, T actual) {
	if (expected == actual)
		reportUnmetExpectation(message,expected,actual);
}

template <class T>
void expectThat (string message, T expected, T actual) {
expectThatRaw(message,expected,actual);
}

template <class T,class U>
void expectThat (string message, T expected, U actual) {
expectThatRaw(message+" (expected was casted to "+typeid(U).name()+")",U(expected),actual);
}
/*
void expectThat(string message,int expected, string actual){
cout << "honeypot";
}*/
template <class T>
void expectThatNot (string message, T expected, T actual) {
expectThatNotRaw(message,expected,actual);
}


template <class T,class U>
void expectThatNot (string message, T expected, U actual) {
expectThatNotRaw(message+" (expected was casted to "+typeid(U).name()+")",U(expected),actual);
}

//void expectThat(string message, char *expected, char *actual)
//{
//	if(strcmp(expected, actual) != 0)
//	{
//		reportUnmetExpectation(message,expected,actual);
//	}
//}


#endif /* SIMPLEASSERT_H_ */
